#Copyright Ken Faulkner 2007.
#!/usr/bin/env python

import sys
from Framework.Downloader.LinkDownloader import LinkDownloader
from Framework.Downloader.RealAudioDownloader import RealAudioDownloader
from configobj import ConfigObj
from Queue import Queue

if __name__ == "__main__":
  config = ConfigObj("Config/bbc.cfg")

  app = LinkDownloader( config )
  
  x = app.getAllUniqueEntries()
  
  for i in x:
    print i
    
  #sys.exit(0)
  
  
  noThreads = int( sys.argv[1] )
  
  threadList = []
  
  requestQ = Queue()
  responseQ = Queue()
  
  requestQ.put( x[0] )
  
  for i in xrange( noThreads ):
    t = RealAudioDownloader( config, requestQ, responseQ )
    threadList.append( t )
    
  for i in threadList:
    i.start()
    
  #for i in threadList:
  #  i.join()
    
  
